version: '3.9'
  

services:
  fnsa-telegram-bot:
    build: fnsa-telegram-bot
    container_name: fnsa-telegram-bot
    environment:
      - CONFIG_FILE_PATH=/app/config.yml
      - ETCD_HOST=etcd
      - ETCD_PORT=2379
    volumes:
      - ./config.yml:/app/config.yml
    depends_on:
      - etcd

###########################################################

  fnsa-news-manager:
    build: fnsa-news-manager
    container_name: fnsa-news-manager
    volumes:
      - ./config.yml:/app/config.yml
    environment:
      - CONFIG_FILE_PATH=/app/config.yml
      - ETCD_HOST=etcd
      - ETCD_PORT=2379
      - PARSE_ONLY_NEW_ITEMS=false
      - CUT_OFF_SECONDS=70000
    depends_on:
      - etcd

###########################################################

  fnsa-inference-manager:
    build: fnsa-inference-manager
    container_name: fnsa-inference-manager
    command: worker
    volumes:
      - ./config.yml:/app/config.yml
    environment:
      - CONFIG_FILE_PATH=/app/config.yml
      - ETCD_HOST=etcd
      - ETCD_PORT=2379
      - REDIS_HOST=redis
      - REDIS_PORT=6379
      - REDIS_DB=0
    depends_on:
      - etcd
      - redis

  fnsa-inference-manager-celery-beat:
    build: fnsa-inference-manager
    container_name: fnsa-inference-manager-celery-beat
    command: beat
    volumes:
      - ./config.yml:/app/config.yml
    environment:
      - CONFIG_FILE_PATH=/app/config.yml
      - ETCD_HOST=etcd
      - ETCD_PORT=2379
      - REDIS_HOST=redis
      - REDIS_PORT=6379
      - REDIS_DB=0
    depends_on:
      - fnsa-inference-manager
      - etcd
      - redis

###########################################################

  fnsa-mlserver:
    container_name: fnsa-mlserver
    image: seldonio/mlserver:1.5.0-huggingface
    environment:
      - MLSERVER_MODELS_DIR=/models
      - MLSERVER_HTTP_PORT=8080
      - MLSERVER_GRPC_PORT=8008
      - MLSERVER_LOAD_MODELS_AT_STARTUP=true
      - MLSERVER_HOST=0.0.0.0
      - MLSERVER_GRPC_MAX_MESSAGE_LENGTH=-1
    volumes:
      - ./fnsa-mlserver/fnsa-mlserver:/models

###########################################################

  redis:
    container_name: redis
    image: redis:7.0.15
    volumes:
      - redis_data:/data

  etcd:
    image: quay.io/coreos/etcd:v3.5.14
    container_name: etcd
    environment:
      - ETCD_NAME=etcd
      - ETCD_INITIAL_ADVERTISE_PEER_URLS=http://etcd:2380
      - ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379
      - ETCD_INITIAL_CLUSTER=etcd=http://etcd:2380
      - ETCD_INITIAL_CLUSTER_STATE=new
      - ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster-1
      - ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380
      - ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
      - ETCD_DATA_DIR=/etcd-data
    volumes:
      - etcd-data:/etcd-data

  etcdkeeper:
    image: evildecay/etcdkeeper
    container_name: etcdkeeper
    environment:
      - EK_ETCD_URL=http://etcd:2379
    ports:
      - "8080:8080"


volumes:
  etcd-data:
  redis_data: